package coolq.yaozhenyong.controller;

import java.util.List;

import com.forte.qqrobot.anno.timetask.CronTask;
import com.forte.qqrobot.sender.MsgSender;
import com.forte.qqrobot.timetask.TimeJob;
import com.forte.qqrobot.utils.CQCodeUtil;

import coolq.yaozhenyong.bean.Claninform;
import coolq.yaozhenyong.custom.SpringContextUtil;
import coolq.yaozhenyong.service.ClaninformService;

@CronTask("0 0 6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22 * * ? ")
public class TimingOne implements TimeJob{

	@Override
	public void execute(MsgSender msgSender, CQCodeUtil cqCodeUtil) {
		System.out.println("提醒报名》》》》定时任务进行 每个小时");
		/****
		  更新机器人加入的群
		 */
		ClaninformService clan = SpringContextUtil.getBean(ClaninformService.class);
		List<Claninform> list = clan.query().eq("isgoto", "1").eq("time", "1").list();
		for (Claninform c : list) {
			msgSender.SENDER.sendGroupMsg(c.getQunnumber(), c.getMsg()+"\n\n请参战的玩家尽快输入指令报名！");
		}
		System.out.println("每小时发送"+list.size()+"条数据");
	}

}
